package com.qf.fmall2203.user.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.fmall2203.user.entity.UserAddr;
import com.qf.fmall2203.user.service.IUserAddrService;
import com.qf.fmall2203.vo.ResultVo;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/useraddr")
@CrossOrigin
@Slf4j
public class UserAddrController {

    @Autowired
    IUserAddrService userAddrService;

    @RequestMapping("/list")
    public ResultVo listAddr(Integer userId){
        log.debug("userID:{}",userId);

        List<UserAddr> user_id = userAddrService.list(new QueryWrapper<UserAddr>().eq("user_id", userId));

       return ResultVo.ok(user_id);


    }
}
